﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZF.BLL;
using System.Web.UI.HtmlControls;
using GCELibrary.Current;
using ZF.Model;
using System.Transactions;
using ZF.BLL.ServiceModel;

namespace ZF.WS.service
{
    public partial class ajdk : BLL.Page.PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                Add();
            }
        }

 
        public void InitControls()
        {
       
        }


        public void Add()
        {
            InitControls();
       
        }
        public void AddSubmit(object sender, EventArgs e)
        {
            if (!SiteInfo.ValidateCode(this.tbVCode.Text))
            {
                WarnFactory.CreateWarn(new PageWarnParameter()
                {
                    JscriptMode = true,
                    Link = WarnLink.GoBack,
                    Message = "验证码错误",
                }).Alert();
                return;
            }
         
                using (var dc = SiteInfo.CreateDBDataContext())
                {
                    var srv = new Model.Sys_Service()
                    {
                        AddTime = DateTime.Now,
                        IsAcc = false,
                        Type = (int)ServiceType.AJDK,
                        Json = Newtonsoft.Json.JsonConvert.SerializeObject(new AJDK()
                        {
                          
                            Credit=this.tbCredit.Text,
                            Type=this.rblType.SelectedValue,
                            Price = this.tbPrice.Text,
                    

                        }),
                        Address = this.tbAddress.Text,
                        Contact = this.tbContact.Text,
                        Email = this.tbEmail.Text,
                        Tel = this.tbTel.Text,
                        Remark = this.tbRemark.Text,
                    };
                     
                    try
                    {
                        dc.Sys_Service.InsertOnSubmit(srv);
                        dc.SubmitChanges();
                    
                    }
                    catch (Exception ex)
                    {
                        throw WarnFactory.CreateWarn(ex);
                    }

                    WarnFactory.CreateWarn(new PageWarnParameter()
                    {
                          JscriptMode=true,
                        Message = "多谢先生/小姐的信任和支持，您的资料已成功递交,我们会将尽快安排物业专员联系您，落实具体办理手续和有关费用，敬请留意。",
                        Link = WarnLink.GoBack,
                    }).Alert();
                    
 

                }
 


        }
    }
}
